import request from '@/utils/request'

export function getDepartments() {
  return request.get('api/company/department')
}

export const getSimpleEmployee = function() {
  return request.get('api/sys/user/simple')
}
export const addDepartment = function(data) {
  return request.post('api/company/department', data)
}
export const delDepartment = function(id) {
  return request.delete(`api/company/department/${id}`)
}
export const getDepartmentsById = function(id) {
  return request.get('api/company/department/' + id)
}

/**
  * @description: 更新部门数据
  * @param {*} data:form表单数据 但是要有id值
  * @return {*}
  */
export function updateDepartments(data) {
  return request({
    url: `api/company/department/${data.id}`,
    method: 'put',
    data
  })
}
